#include<gtest/gtest.h>

#include"Executor.hpp"

#include"PoseEq.hpp"

namespace adas
{
//测试化用例54：从东掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_build_left_forward_left_E)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0,0,'E'},CarsType::CAR));

    //when
    executor->Execute("TR");

    //then
    const Pose target({0,1,'W'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例55：从西掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_build_left_forward_left_W)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'W'}, CarsType::CAR));
    //when
    executor->Execute("TR");

    //then
    const Pose target({0,-1,'E'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例56：从南掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_build_left_forward_left_S)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'S'}, CarsType::CAR));
    //when
    executor->Execute("TR");

    //then
    const Pose target({1,0,'N'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例57：从北掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_build_left_forward_left_N)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'N'}, CarsType::CAR));

    //when
    executor->Execute("TR");

    //then
    const Pose target({-1,0,'S'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例58：从东加速掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_status_is_fast_build_left_forward_left_E)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}, CarsType::CAR));
    //when
    executor->Execute("FTR");

    //then
    const Pose target({1,1,'W'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例59：从西加速掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_status_is_fast_build_left_forward_left_W)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'W'}, CarsType::CAR));

    //when
    executor->Execute("FTR");

    //then
    const Pose target({-1,-1,'E'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例60：从南加速掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_status_is_fast_build_left_forward_left_S)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'S'}, CarsType::CAR));

    //when
    executor->Execute("FTR");

    //then
    const Pose target({1,-1,'N'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例61：从北加速掉头
TEST(ExecutorTurnRoundTest,should_normal_tr_status_is_fast_build_left_forward_left_N)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'N'}, CarsType::CAR));

    //when
    executor->Execute("FTR");

    //then
    const Pose target({-1,1,'S'});
    ASSERT_EQ(target,executor->Query());
}
//测试化用例62：倒车调头,不受影响
TEST(ExecutorTurnRoundTest,should_normal_tr_status_is_backward_build_left_backward_left_E)
{
    //given
    std::unique_ptr<Executor> executor(Executor::NewExecutor({0, 0, 'E'}, CarsType::CAR));
    //when
    executor->Execute("BTR");
    //then
    const Pose target({0,0,'E'});
    ASSERT_EQ(target,executor->Query());
}
}